package com.ywu.bpmn.form.standard.api;

import com.ywu.bpmn.form.service.dto.YwuFormDefinitionDto;
import com.ywu.bpmn.form.service.dto.YwuFormDefinitionVersionDto;
import com.ywu.bpmn.form.standard.service.YwuFormService;
import com.ywu.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuFormApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/4/20 14:35
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/bpmn/form")
public class YwuFormApi {

    @Autowired
    private YwuFormService service;

    /**
    * @Author GroundDemo
    * @Description 创建表单
    * @Date 17:08 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.form.info")
    public CommonResult<Object> createForm(@RequestBody YwuFormDefinitionDto dto) {
        return service.createForm(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改表单信息
    * @Date 17:09 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.form.info")
    public CommonResult<Object> updateForm(@RequestBody YwuFormDefinitionDto dto) {
        return service.updateForm(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改表单json
    * @Date 17:13 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.form.json.info")
    public CommonResult<Object> updateFormJson(@RequestBody YwuFormDefinitionDto dto) {
        return service.updateFormJson(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除表单
    * @Date 17:10 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.form.info")
    public CommonResult<Object> deleteForm(@RequestBody YwuFormDefinitionDto dto) {
        return service.deleteForm(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询表单列表
    * @Date 17:11 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.page.list.info")
    public CommonResult<Object> queryFormPageList(@RequestBody YwuFormDefinitionDto dto) {
        return service.queryFormPageList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询表单详情
    * @Date 17:11 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.info")
    public CommonResult<Object> queryFormInfo(@RequestBody YwuFormDefinitionDto dto) {
        return service.queryFormInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 发布表单
    * @Date 17:14 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/publish.form.info")
    public CommonResult<Object> publishFormInfo(@RequestBody YwuFormDefinitionDto dto) {
        return service.publishFormInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询历史版本列表
    * @Date 17:17 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.version.list.info")
    public CommonResult<Object> queryVersionList(@RequestBody YwuFormDefinitionDto dto) {
        return service.queryVersionList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询历史版本详情
    * @Date 17:18 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.version.info")
    public CommonResult<Object> queryVersionInfo(@RequestBody YwuFormDefinitionVersionDto dto) {
        return service.queryVersionInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除历史版本
    * @Date 17:18 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.form.version.info")
    public CommonResult<Object> deleteVersionInfo(@RequestBody YwuFormDefinitionVersionDto dto) {
        return service.deleteVersionInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 回退历史版本
    * @Date 17:19 2025/4/20
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/back.form.version.info")
    public CommonResult<Object> backVersionInfo(@RequestBody YwuFormDefinitionVersionDto dto) {
        return service.backVersionInfo(dto);
    }


}
